package com.shuai.utils.query;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * 查询条件
 *
 * @author shuai
 * @since 2022
 */
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class ParentQuery {

    /**
     * id
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * ids
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private List<Long> ids;

    /**
     * 页码
     */
    @Builder.Default
    private Integer page = 1;

    /**
     * 每页显示条数
     */
    @Builder.Default
    private Integer limit = 50;

    /**
     * 排序字段，默认id
     */
    @Builder.Default
    private String orderBy = "id";

    /**
     * 排序方式，默认倒序
     */
    @Builder.Default
    private String order = "desc";
}